Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Files

Previous | Chapter Top | Chapter Contents | Next |

Modal-Dialog Filter Functions

A modal-dialog filter function controls events closer to their source by filtering the events received from the Event Manager. The Standard File Package itself contains an internal modal-dialog filter function that maps keypresses and other user input onto the equivalent dialog box items. If you also want to process events at this level, you can supply your own filter function.

MyModalFilter

A modal-dialog filter function whose address is passed to SFPGetFile or SFPPutFile should have the following form:

FUNCTION MyModalFilter (theDialog: DialogPtr;
                                         VAR theEvent: EventRecord;
                                         VAR itemHit: Integer): Boolean;
theDialog
A pointer to the dialog record of the dialog box.
theEvent
The event record for the event.
itemHit
The number of the item selected.

DESCRIPTION

Your modal-dialog filter function determines how the Dialog Manager procedure ModalDialog filters events. The ModalDialog procedure retrieves events by calling the Event Manager function GetNextEvent . The Standard File Package contains an internal filter function that performs some preliminary processing on each event it receives. If you provide a modal-dialog filter function, ModalDialog calls your filter function after it calls the internal Standard File Package filter function and before it sends the event to your dialog hook function.

Your modal-dialog filter function returns a Boolean value that reports whether it handled the event. If your function returns a value of FALSE , ModalDialog processes the event through its own filters. If your function returns a value of TRUE , ModalDialog returns with no further action.

SEE ALSO

See "Writing a Modal-Dialog Filter Function" for a sample modal-dialog filter function.

MyModalFilterYD

A modal-dialog filter function whose address is passed to CustomGetFile or CustomPutFile should have the following form:

FUNCTION MyModalFilterYD (theDialog: DialogPtr;
                                         VAR theEvent: EventRecord;
                                         VAR itemHit: Integer;
                                         myDataPtr: Ptr): Boolean;
theDialog
A pointer to the dialog record of the dialog box.
theEvent
The event record for the event.
itemHit
The number of the item selected.
myDataPtr
A pointer to the optional data whose address is passed to CustomGetFile or CustomPutFile .

DESCRIPTION

Your modal-dialog filter function determines how the Dialog Manager procedure ModalDialog filters events. The ModalDialog procedure retrieves events by calling the Event Manager function GetNextEvent . The Standard File Package contains an internal filter function that performs some preliminary processing on each event it receives. If you provide a modal-dialog filter function, ModalDialog calls your filter function after it calls the internal Standard File Package filter function and before it sends the event to your dialog hook function.

Your modal-dialog filter function returns a Boolean value that reports whether it handled the event. If your function returns a value of FALSE , ModalDialog processes the event through its own filters. If your function returns a value of TRUE , ModalDialog returns with no further action.

SEE ALSO

See "Writing a Modal-Dialog Filter Function" for a sample modal-dialog filter function.


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents | Next